import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import Framework.*;


public class win_Utilities extends pnl_Ancestor implements ActionListener{
	
	btn_TopButtons 		b_TopButtons		 	= new btn_TopButtons("Utilities");

	btn_Ancestor btn_OpenCalculatorWindow 		= new btn_Ancestor("Calculator");
	btn_Ancestor btn_OpenCalendarWindow			= new btn_Ancestor("Calendar");
	btn_Ancestor btn_OpenConverterWindow 		= new btn_Ancestor("Converter");
	btn_Ancestor btn_OpenBrowserWindow		 	= new btn_Ancestor("Browser");
	
	
	public win_Utilities(){
		super(); // Remember to always call super on JPanel_Anc constructors!
		// By default JPanel_Anc will set the layout manager to null. this allows setBounds() 
		// to do what it's told (Sometimes it doesnt with layout managers.). 
		// Feel free to add your own JFrame *inside* this one, and use a layout manager in that.
		// it'll void your warentee though because I don't get them : / 
		
		
		// Setting coordinates and size of Buttons.
		// Coordinates are (1,2,3,4) where 1 is horizontal begin, 2 is verticle begin
		// 								   3 is horizontal end	  4 is verticle end.
		btn_OpenCalculatorWindow.setBounds(150,110,200,200);	
		btn_OpenCalendarWindow.setBounds(400,110,200,200);
		btn_OpenConverterWindow.setBounds(150, 360, 200, 200);
		btn_OpenBrowserWindow.setBounds(400, 360, 200, 200);
		
		// Adding buttons to event handler.
		btn_OpenCalculatorWindow.addActionListener(this);
		btn_OpenCalendarWindow.addActionListener(this);
		btn_OpenConverterWindow.addActionListener(this);
		btn_OpenBrowserWindow.addActionListener(this);

		this.add(b_TopButtons);
		
		// Adding buttons to view
		this.add(btn_OpenCalculatorWindow);
		this.add(btn_OpenCalendarWindow);
		this.add(btn_OpenConverterWindow);
		this.add(btn_OpenBrowserWindow);
		
	}
	
	public void actionPerformed(ActionEvent e) {
		
		Object actionSource = (btn_Ancestor) e.getSource();
		
		if (actionSource.equals(btn_OpenCalculatorWindow)){
			enterSubMenu(TeamRocket.w_Calculator);
		} else if (actionSource.equals(btn_OpenCalendarWindow)){
			enterSubMenu(TeamRocket.w_Calendar);
		} else if (actionSource.equals(btn_OpenConverterWindow)){
			enterSubMenu(TeamRocket.w_Converter);
		} else if (actionSource.equals(btn_OpenBrowserWindow)){
			enterSubMenu(TeamRocket.w_Browser);
		} 
	}
}